package com.zoho.daliansheng.controller;

import com.zoho.daliansheng.service.*;
import com.zoho.daliansheng.utils.ResultUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;


@RestController
@RequestMapping("/task")
@CrossOrigin
public class TaskController {

    WarehouseService warehouseService;

    ProductService productService;

    UserService userService;

    CustomerAuthService customerAuthService;

    AcceptListService acceptlistService;

    AcceptListBusinessService acceptListBusinessService;

    public TaskController(WarehouseService warehouseService, ProductService productService, UserService userService, CustomerAuthService customerAuthService, AcceptListService acceptlistService, AcceptListBusinessService acceptListBusinessService) {
        this.warehouseService = warehouseService;
        this.productService = productService;
        this.userService = userService;
        this.customerAuthService = customerAuthService;
        this.acceptlistService = acceptlistService;
        this.acceptListBusinessService = acceptListBusinessService;
    }

    @PostMapping("/synProduct")
    public ResultUtil<Object> synProduct() {
        productService.synProduct();
        return ResultUtil.success();
    }

    @PostMapping("/synWareHouse")
    public ResultUtil<Object> synWareHouse() {
        warehouseService.synWarehouse();
        return ResultUtil.success();
    }

    @PostMapping("/synUser")
    public ResultUtil<Object> synUser() {
        userService.synUser();
        return ResultUtil.success();
    }

    @PostMapping("/sysCustomerAuth")
    public ResultUtil<Object> sysCustomerAuth() {
        customerAuthService.sysCustomerAuth();
        return ResultUtil.success();
    }

    @PostMapping("/synAcceptList")
    public ResultUtil<Object> synAcceptList() {
        acceptlistService.synAcceptList();
        acceptListBusinessService.synAcceptBusinessList();
        return ResultUtil.success();
    }


}
